<!DOCTYPE">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <title>{{\App\Setting::getConfig('title')}}-疯狂打企鹅</title>
    <!--jQuery-->
    <script type="text/javascript" src="/test-game/daqie/js/createjs.min.js"></script>
    <script type="text/javascript" src="/test-game/daqie/js/zepto.min.js"></script>
    <script src="/test-game/daqie/js/common.js"></script>
    <link type="text/css" href="/test-game/daqie/js/common.css" rel="stylesheet" />
    <style>
        body,html{padding:0;margin:0;width:100%;height:100%;background:#000;-webkit-tap-highlight-color: transparent;}
        canvas{width:100%;height:100%;}
        #container{
            position:absolute;
            bottom:0;left:0;width:100%;height:100%;
        }
    </style>
</head>

<body>

<div id="container">
    <canvas id="canvas"></canvas>
</div>

<div style="display: none;">
</div>
<script src="/test-game/daqie/js/index.js"></script>
<script src="/test-game/daqie/js/flyline.js"></script>
<script language=javascript>

    var mebtnopenurl = '{{url('test/qie')}}';
    window.shareData = {
        "imgUrl": "{{asset('/test-game/daqie/img/icon.png')}}",
        "timeLineLink": "{{url('test/qie')}}",
        "tTitle": "打企鹅-{{\App\Setting::getConfig('title')}}",
        "tContent": "打企鹅-{{\App\Setting::getConfig('title')}}"
    };

    function goHome(){
        window.location=mebtnopenurl;
    }
    function clickMore(){
        if((window.location+"").indexOf("zf",1)>0){
            window.location = "{{url('test/qie')}}";
        }
        else{
            goHome();
        }
    }
    function dp_share(){
        document.title ="你简直霸气侧漏，把企鹅击飞出"+myData.scoreName+"，谁还能超越我？";
        document.getElementById("share").style.display="";
        window.shareData.tTitle = document.title;
    }
    function dp_Ranking(){
        window.location=mebtnopenurl;
    }

    function showAd(){
    }
    function hideAd(){
    }
    document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {

        WeixinJSBridge.on('menu:share:appmessage', function(argv) {
            WeixinJSBridge.invoke('sendAppMessage', {
                "img_url": window.shareData.imgUrl,
                "link": window.shareData.timeLineLink,
                "desc": window.shareData.tContent,
                "title": window.shareData.tTitle
            }, onShareComplete);
        });

        WeixinJSBridge.on('menu:share:timeline', function(argv) {
            WeixinJSBridge.invoke('shareTimeline', {
                "img_url": window.shareData.imgUrl,
                "img_width": "640",
                "img_height": "640",
                "link": window.shareData.timeLineLink,
                "desc": window.shareData.tContent,
                "title": window.shareData.tTitle
            }, onShareComplete);
        });
    }, false);
</script>
<div id=share style="display: none">
    <img width=100% src="/test-game/daqie/share.png"
         style="position: fixed; z-index: 9999; top: 0; left: 0; display: "
         ontouchstart="document.getElementById('share').style.display='none';" />
</div>
<div style="display: none;">
    <script type="text/javascript">
        var myData = { gameid: "dqe" };
        window.shareData.timeLineLink = "{{url('test/qie')}}";
        function dp_submitScore(score){
            myData.score = score*10;
            myData.scoreName = score+"米";
            if(score>0){
                if (confirm("你太猛了，大力出奇迹，一下把伦家击飞"+score+"米！要不要通知一下小伙伴")){
                    dp_share();
                }
            }
        }
        function onShareComplete(res) {
            if (localStorage.myuid && myData.score != undefined) {
                setTimeout(function(){
                    if (confirm("要将成绩提交到微资源排行榜吗？")) {
                        //window.location = "http://sc.chinaz.com/index.html?gameid=" + myData.gameid + "&uid=" + localStorage.myuid + "&score=" + myData.score + "&scorename=" + encodeURIComponent(myData.scoreName);
                    }
                    else {
                        document.location.href = mebtnopenurl;
                    }
                }, 500);
            }
            else {
                document.location.href = mebtnopenurl;
            }
        }
        $(function(){
            var overscroll = function(el) {
            el.addEventListener('touchstart', function() {
                var top = el.scrollTop
                    , totalScroll = el.scrollHeight
                    , currentScroll = top + el.offsetHeight;
                //If we're at the top or the bottom of the containers
                //scroll, push up or down one pixel.
                //
                //this prevents the scroll from "passing through" to
                //the body.
                if(top === 0) {
                    el.scrollTop = 1;
                } else if(currentScroll === totalScroll) {
                    el.scrollTop = top - 1;
                }
            });
            el.addEventListener('touchmove', function(evt) {
                //if the content is actually scrollable, i.e. the content is long enough
                //that scrolling can occur
                if(el.offsetHeight < el.scrollHeight)
                    evt._isScroller = false;
                });
            }
            overscroll(document.querySelector('#container'));
            document.body.addEventListener('touchmove', function(evt) {
                //In this case, the default behavior is scrolling the body, which
                //would result in an overflow.  Since we don't want that, we preventDefault.
                if(!evt._isScroller) {
                    evt.preventDefault();
                }
            });
        })
    </script>
    <div style="display: none;">

    </div>
</body>
</html>